<template>
  <div>
    <el-card shadow="never" class="mb20">
      <el-row :gutter="16" style="line-height: 36px">
        <el-col :span="4">
          <el-button @click="$router.go(-1)">返回</el-button>
        </el-col>
        <el-col :span="6">
          <h3 class="mb0">
            姓名：
            <span>{{ leaderRow.name }}</span>
          </h3>
        </el-col>
        <el-col :span="6">
          <h3 class="mb0">
            单位：
            <span>{{ leaderRow.workUnit }}</span>
          </h3>
        </el-col>
      </el-row>
    </el-card>
    <el-card shadow="never" class="mb20">
      <el-tabs class="person-tabs" :tab-position="tabPosition">
        <el-tab-pane label="个人信息">
          <basic-comp ref="basciComp" />
          <!-- <job-table ref="jobTable" @edit="handleEdit" /> -->
        </el-tab-pane>
        <el-tab-pane label="从事信息">
          <job-table ref="jobTable" @edit="handleEdit" />
        </el-tab-pane>
        <el-tab-pane label="奖惩情况">
          <reward-table ref="rewardTable" />
        </el-tab-pane>
        <el-tab-pane label="责任制情况">
          <duty-table ref="dutyTable" />
        </el-tab-pane>
        <el-tab-pane label="家庭主要成员">
          <family-table ref="familyTable" />
        </el-tab-pane>
        <el-tab-pane label="廉政谈话情况">
          <talk-table ref="talkTable" />
        </el-tab-pane>
        <el-tab-pane label="住房情况">
          <house-table ref="houseTable" />
        </el-tab-pane>
        <el-tab-pane label="拒收或上交礼金情况">
          <gift-table ref="giftTaBle" />
        </el-tab-pane>
        <el-tab-pane label="婚丧喜庆事宜">
          <funeral-table ref="funeralTable" />
        </el-tab-pane>
        <el-tab-pane label="婚姻变化情况">
          <marrige-table ref="marrigeTable" />
        </el-tab-pane>
        <el-tab-pane label="被举报控告情况">
          <tip-table ref="tipTable" />
        </el-tab-pane>
      </el-tabs>
    </el-card>
    <integrity-modal ref="integrityModal" @refresh="handleRefresh" />
  </div>
</template>

<script>
import BasicComp from '../userDetail/BasicComp'
import JobTable from './JobTable'
import RewardTable from './RewardTable'
import DutyTable from './DutyTable'
import FamilyTable from './FamilyTable'
import TalkTable from './TalkTable'
import HouseTable from './HouseTable'
import GiftTable from './GiftTable'
import MarrigeTable from './MarrigeTable'
import TipTable from './TipTable'
import FuneralTable from './FuneralTable'

import IntegrityModal from './IntegrityModal'
import { removeSession, getSession } from '@/utils/util'

export default {
  components: {
    BasicComp,
    JobTable,
    IntegrityModal,
    RewardTable,
    DutyTable,
    FamilyTable,
    TalkTable,
    GiftTable,
    HouseTable,
    MarrigeTable,
    TipTable,
    FuneralTable
  },
  data() {
    return {
      tabPosition: 'left',
      leaderRow: JSON.parse(this.$route.query.leaderRow)
    }
  },
  methods: {
    handleRefresh() {
      this.$refs.jobTable.handleGetList()
    },
    handleSearch(obj) {
      this.$refs.jobTable.handleGetList(obj)
    },
    handleAddUser() {
      this.$refs.integrityModal.edit(false, {})
    },
    handleEdit(bool, obj) {
      this.$refs.integrityModal.edit(bool, obj)
    }
  },
  created() {
    console.log('leaderRow', this.leaderRow)
  },
  destroyed() {
    removeSession('leaderRow')
  }
}
</script>
